package com.wuyou.simple;

import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

/**
 * 9. 回文数
 */
public class IsPalindrome {

    public static void main(String[] args) {
        int x = 121;
        System.out.println(solution_1(x));
    }
    public static boolean solution_1(int x){
        if(x < 0) return false;
        Queue<Integer> queue = new LinkedList<>();
        while (x > 0) {
            queue.add(x % 10);
            x /= 10;
        }
        queue.poll();
        Integer[] nums = (Integer[]) queue.toArray();
        int left = 0, right = nums.length - 1;
        while (left < right) {
            if(nums[left++] != nums[right--]) return false;
        }
        return true;
    }
}
